package com.woody.aggregate.infrastructure.shop.es.esdoc;

import lombok.Data;
import org.dromara.easyes.annotation.*;
import org.dromara.easyes.annotation.rely.Analyzer;
import org.dromara.easyes.annotation.rely.FieldType;
import org.dromara.easyes.annotation.rely.IdType;

import java.util.Date;


/**
 * &copy; All rights Reserved
 *
 * @author wénkǎi.zhāng 2025-04-07
 */
@Data
@IndexName("ai_shop_index")
public class ShopInfo {

    @IndexId(type = IdType.CUSTOMIZE)
    private String id;

    /**
     * 店铺ID
     */
    @IndexField(fieldType = FieldType.KEYWORD)
    private String shopId;

    /**
     * 店铺名称，使用IK中文分词器进行搜索优化
     */
    @MultiIndexField(mainIndexField = @IndexField(fieldType = FieldType.TEXT, analyzer = Analyzer.IK_MAX_WORD, searchAnalyzer = Analyzer.IK_SMART),
            otherIndexFields = {@InnerIndexField(suffix = "keyword", fieldType = FieldType.KEYWORD)})
    private String shopName;

    /**
     * 省份ID
     */
    @IndexField(fieldType = FieldType.KEYWORD)
    private String provinceId;

    /**
     * 城市ID
     */
    @IndexField(fieldType = FieldType.KEYWORD)
    private String cityId;

    /**
     * 区县ID
     */
    @IndexField(fieldType = FieldType.KEYWORD)
    private String areaId;

    /**
     * 省份名称
     */
    @IndexField(fieldType = FieldType.KEYWORD)
    private String province;

    /**
     * 城市名称
     */
    @IndexField(fieldType = FieldType.KEYWORD)
    private String city;

    /**
     * 区县名称
     */
    @IndexField(fieldType = FieldType.KEYWORD)
    private String area;

    /**
     * 店铺地址
     */
    @IndexField(fieldType = FieldType.TEXT, analyzer = Analyzer.IK_SMART, searchAnalyzer = Analyzer.IK_SMART)
    private String shopAddress;

    /**
     * 所属精选行业编码
     */
    @IndexField(fieldType = FieldType.KEYWORD)
    private String saasIndustryCode;

    /**
     * 平台行业编码
     */
    @IndexField(fieldType = FieldType.KEYWORD)
    private String industryCode;

    /**
     * 父门店店ID
     */
    @IndexField(fieldType = FieldType.KEYWORD)
    private String parentId;

    /**
     * 门头图文件ID列表
     */
    private String facadePicIds;

    /**
     * 详情图文件ID列表
     */
    private String detailPicsFileIds;

    /**
     * 店铺Logo文件ID
     */
    private String shopLogoFileId;

    /**
     * 门头照图片URL，多个通过英文逗号分隔
     */
    private String facadePicUrls;

    /**
     * 门店背景图URL，多个通过英文逗号分隔
     */
    private String detailPicUrls;

    /**
     * 门店logo图片
     */
    private String shopLogoUrl;

    /**
     * 经纬度坐标，用于附近搜索，格式：lat,lon
     */
    @IndexField(fieldType = FieldType.GEO_POINT)
    private String shopLatLng;

    /**
     * 门店状态：ShopStatusEnum
     */
    @IndexField(fieldType = FieldType.KEYWORD)
    private String shopStatus;

    /**
     * 店铺等级（星级）
     */
    @IndexField(fieldType = FieldType.INTEGER)
    private Integer grade;

    /**
     * 销量数据
     */
    @IndexField(fieldType = FieldType.INTEGER)
    private Integer sales;

    /**
     * 质量
     */
    @IndexField(fieldType = FieldType.INTEGER)
    private Integer qualityRate;

    /**
     * 店铺类型（参考 EsShopTypeEnum）
     */
    @IndexField(fieldType = FieldType.INTEGER)
    private Integer shopType;

    /**
     * 展示类型（参考ShopListDisplayType）
     */
    @IndexField(fieldType = FieldType.INTEGER)
    private Integer displayType;

    /**
     * 门店授权开始时间（秒级时间戳）
     */
    @IndexField(fieldType = FieldType.INTEGER)
    private Integer authBeginTime;

    /**
     * 门店授权结束时间（秒级时间戳）
     */
    @IndexField(fieldType = FieldType.INTEGER)
    private Integer authEndTime;

    @IndexField(fieldType = FieldType.DATE)
    private Date esCreateTime;

    @IndexField(fieldType = FieldType.DATE)
    private Date esUpdateTime;

    /**
     * 若es有返回距离,则距离会自动映射至此字段
     */
    @Distance
    @IndexField(exist = false)
    private Double distance;

}
